//
//  HWRequestTool.h
//  HomeWork
//
//  Created by apple on 2017/10/25.
//  Copyright © 2017年 apple. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HWHttpSessionManager.h"
@class HWRequestTool;

typedef void(^success)(HWRequestTool *request, id response);
typedef void(^failure)(HWRequestTool *request, NSError *error);

@interface HWRequestTool : NSObject


/**
 *[继承于AFNetWorking]的operationManager对象
 */
@property (nonatomic, strong) HWHttpSessionManager *operationManager;

/**
 *当前的请求operation队列
 */
@property (nonatomic, strong) NSOperationQueue* operationQueue;

/** 当前的网络请求任务 */
@property (strong, nonatomic) NSURLSessionDataTask *dataTask;

/**
 GET请求
 
 @param URLString 请求的url
 @param parameters POST请求体参数
 @param success 请求成功调用的Block
 @param failure 请求失败调用的Block
 */
- (NSURLSessionDataTask *)GET:(NSString *)URLString parameters:(NSDictionary*)parameters success:(success)success failure:(failure)failure;

/**
 GET请求
 
 @param URLString 请求的url
 @param parameters POST请求体参数
 @param success 请求成功调用的Block
 @param failure 请求失败调用的Block
 */
+ (NSURLSessionDataTask *)GET:(NSString *)URLString parameters:(NSDictionary*)parameters success:(success)success failure:(failure)failure;


/**
 *取消当前请求队列的所有请求
 */
- (void)cancelAllOperations;

@end

